import { useTable, LIST_TYPE } from '@crud/index';
import { getColonelLogList } from '@/api/crm-agency/kgj/colonel';
// 查询
export const typeMap: Record<string, any> = {
  1: '增加保证金',
  2: '减少保证金',
  3: '赠送奖励金',
  4: '发放周卡',
  5: '发放月卡',
  6: '发放季卡',
  7: '发放年卡'
};
// 表格
export const useTableList = (options: any = {}) => {
  const columns: any = [
    { label: '操作员', prop: 'name', minWidth: 100, fixed: 'left' },
    { label: '操作内容', prop: 'type', minWidth: 120, render: (s:any) => typeMap[s.row.type] || '-' },
    { label: '操作明细', prop: 'inc_num', minWidth: 120 },
    { label: '备注', prop: 'remark', minWidth: 120, tooltip: true },
    { label: '操作时间', prop: 'add_time', minWidth: 160, type: 'dateTime' }
  ];

  return useTable({
    ...options,
    type: LIST_TYPE.AGENCY,
    params: {
      colonelId: undefined
    },
    columns: columns,
    // usePagination: false,
    getList: async ({ params = {}, data = {} }: { params: any; data: any }) => {
      if (!data.colonelId) return;
      const res = await getColonelLogList({ data, params });
      return res;
    }
  });
};
